package demo1;

import java.util.Scanner;

public class demo_7 {
    public static int getScore(int a[], int n){
        int score = 0;
        for (int i = 0; i < n - 1; i++){
            for (int j =  0; j < n - i - 1; j++){
                if (a[j] > a[j + 1]){
                    int temp = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = temp;
                }
            }
        }
        for (int i = 1; i < n - 1; i++){
            score += a[i];
        }
        return score / ( n - 2);
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入有几个评委打分：");
        int n = sc.nextInt();
        int[] a = new int[n];
        System.out.println("请输入各评委的评分：");
        for (int i = 0; i < a.length; i++) {
            a[i] = sc.nextInt();
        }
        int rs = getScore(a, n);
        System.out.println("平均分为：" + rs);

    }
}
